﻿using WS.EKA.Model;
using System.Data.SqlClient;
using System;

namespace WS.EKA.DataAccess
{
    public class MemberMessageContext : DBContext<MemberMessage>
    {
        public static int IsReaded(Guid guid, string memLoginID)
        {
            var parameter = new SqlParameter[] { 
                new SqlParameter("Guid", guid), 
                new SqlParameter("ReceiveMemLoginID", memLoginID) 
            };
            string sql = "update ShopNum1_AgentMemberMessage set IsRead=1 where MessageInfoGuid=@Guid and ReceiveMemLoginID=@ReceiveMemLoginID";
            var result = MemberMessageContext.ExecSQL(sql, parameter);
            return result;
        }

        public static int Delete(Guid guid, string memLoginID)
        {
            var parameter = new SqlParameter[] { 
                new SqlParameter("Guid", guid), 
                new SqlParameter("ReceiveMemLoginID", memLoginID) 
            };
            string sql = "update ShopNum1_AgentMemberMessage set ReceiveIsDeleted=1 where MessageInfoGuid=@Guid and ReceiveMemLoginID=@ReceiveMemLoginID";
            var result = MemberMessageContext.ExecSQL(sql, parameter);
            return result;
        }
    }
}
